import requests


class TokenUtils:
    @staticmethod
    def get_uuid():
        captchaimage = requests.get(url='http://192.168.10.130:9632/captchaImage')
        res_uuid = captchaimage.json()
        uuid = res_uuid["uuid"]
        return uuid
    @staticmethod
    def get_wms_token():
        captchaimage = requests.get(url='http://192.168.10.130:9632/captchaImage')
        res_uuid = captchaimage.json()
        uuid = res_uuid["uuid"]
        url = 'http://192.168.10.130:9632/login'
        response = requests.post(url=url, json={"username":"admin",
                                                "password":"e10adc3949ba59abbe56e057f20f883e",
                                                "code":"2",
                                                "uuid":uuid})
        res = response.json()
        return 'Bearer '+res["token"]